// src/app.ts
import prisma from "../src/orm/prisma";

async function main() {
  // 查询 Blog 模型
  const blogs = await prisma.blog.findMany({
    select: { id: true, title: true, created_at: true },
  });

  console.log(blogs[0]);
  // {
  //   id: 1,
  //   title: 'Prisma 教程',
  //   created_at: 2025-09-11T22:00:56.000Z,
  //   created_at_formatted: '2025/09/12 06:00:56'
  // }

  // 查询 User 模型
  const user = await prisma.user.findUnique({
    where: { id: 1 },
    select: { id: true, username: true, created_at: true },
  });

  console.log(user);
  // {
  //   id: 1,
  //   username: 'test',
  //   created_at: 2025-09-10T10:00:00.000Z,
  //   created_at_formatted: '2025/09/10 18:00:00'
  // }
}

// main();
import { prismaSqlUtils, PrismaSqlUtils } from "../src/utils/prisma.sql.utils";
// 打印出 PrismaSqlUtils 的所有方法
console.log(typeof PrismaSqlUtils);
console.log(Object.getOwnPropertyNames(PrismaSqlUtils));
console.log(typeof prismaSqlUtils);
async function executeSql() {
  const result = await prismaSqlUtils.executeRawQuery(
    "SELECT * FROM blog WHERE id = ?",
    [1]
  );
  console.log(result);
}
executeSql();
